home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Graphics Programming (2nd Edition) / Visual Basic Graphics Programming 2nd Edition.iso / OldSrc / CH6 / SRC / AALIAS2.BAS < prev    next >
Encoding:
BASIC Source File  |  1997-01-08  |  2.3 KB  |  51 lines

  1. Attribute VB_Name = "AntiAlias"
  2. Option Explicit
  3.  
  4. Type PALETTEENTRY
  5.     peRed As Byte
  6.     peGreen As Byte
  7.     peBlue As Byte
  8.     peFlags As Byte
  9. End Type
  10.  
  11. ' GetDeviceCaps constants.
  12. Global Const RASTERCAPS = 38    ' Raster device capabilities.
  13. Global Const RC_PALETTE = &H100 ' Has palettes.
  14.  
  15. #If Win32 Then  ' 32-bit VB.
  16.     Type BITMAP ' 24 bytes
  17.         bmType As Long
  18.         bmWidth As Long
  19.         bmHeight As Long
  20.         bmWidthBytes As Long
  21.         bmPlanes As Integer
  22.         bmBitsPixel As Integer
  23.         bmBits As Long
  24.     End Type
  25.     Global Const BITMAP_SIZE = 24
  26.     Declare Function GetDeviceCaps Lib "gdi32" (ByVal hdc As Integer, ByVal nIndex As Integer) As Integer
  27.     Declare Function GetSystemPaletteEntries Lib "gdi32" (ByVal hdc As Integer, ByVal wStartIndex As Integer, ByVal wNumEntries As Integer, lpPaletteEntries As PALETTEENTRY) As Integer
  28.     Declare Function GetBitmapBits Lib "gdi32" (ByVal hBitmap As Integer, ByVal dwCount As Long, lpBits As Any) As Long
  29.     Declare Function SetBitmapBits Lib "gdi32" (ByVal hBitmap As Integer, ByVal dwCount As Long, lpBits As Any) As Long
  30.     Declare Function GetObject Lib "gdi32" Alias "GetObjectA" (ByVal hObject As Long, ByVal nCount As Long, lpObject As Any) As Long
  31.     Declare Function RealizePalette Lib "gdi32" (ByVal hdc As Long) As Long
  32. #Else           ' 16-bit VB.
  33.     Type BITMAP ' 14 bytes
  34.         bmType As Integer
  35.         bmWidth As Integer
  36.         bmHeight As Integer
  37.         bmWidthBytes As Integer
  38.         bmPlanes As String * 1
  39.         bmBitsPixel As String * 1
  40.         bmBits As Long
  41.     End Type
  42.     Global Const BITMAP_SIZE = 14
  43.     Declare Function GetDeviceCaps Lib "GDI" (ByVal hdc As Integer, ByVal nIndex As Integer) As Integer
  44.     Declare Function GetSystemPaletteEntries Lib "GDI" (ByVal hdc As Integer, ByVal wStartIndex As Integer, ByVal wNumEntries As Integer, lpPaletteEntries As PALETTEENTRY) As Integer
  45.     Declare Function GetBitmapBits Lib "GDI" (ByVal hBitmap As Integer, ByVal dwCount As Long, lpBits As Any) As Long
  46.     Declare Function SetBitmapBits Lib "GDI" (ByVal hBitmap As Integer, ByVal dwCount As Long, lpBits As Any) As Long
  47.     Declare Function GetObject Lib "GDI" (ByVal hObject As Integer, ByVal nCount As Integer, lpObject As Any) As Integer
  48.     Declare Function RealizePalette Lib "User" (ByVal hdc As Integer) As Integer
  49. #End If
  50.  
  51.